import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule, Routes} from '@angular/router';

import {FrontComponent} from './front.component';
import {StructComponent} from './struct/struct.component';
import {StyleComponent} from './style/style.component';
import {ScriptComponent} from './script/script.component';
import {JsComponent} from './script/js/js.component';
import {TsComponent} from './script/ts/ts.component';
import {HtmlComponent} from './struct/html/html.component';
import {JadeComponent} from './struct/jade/jade.component';
import {CssComponent} from './style/css/css.component';
import {LessComponent} from './style/less/less.component';
import {SassComponent} from './style/sass/sass.component';

const frontRoutes: Routes = [
  {
    path: '', component: FrontComponent, children: [
      {path: '', redirectTo: '/front/struct', pathMatch: 'full'},
      {
        path: 'struct', component: StructComponent, children: [
          {path: '', redirectTo: '/front/struct/html', pathMatch: 'full'},
          {path: 'html', component: HtmlComponent},
          {path: 'jade', component: JadeComponent}]
      },
      {
        path: 'style', component: StyleComponent, children: [
          {path: 'css', component: CssComponent},
          {path: 'less', component: LessComponent},
          {path: 'sass', component: SassComponent}]
      },
      {
        path: 'script', component: ScriptComponent, children: [
          {path: 'js', component: JsComponent},
          {path: 'ts', component: TsComponent}]
      }]
  }
];

@NgModule({
  imports: [
    CommonModule,
    RouterModule.forChild(frontRoutes)
  ],
  declarations: [FrontComponent, StructComponent, StyleComponent, ScriptComponent, JsComponent, TsComponent, HtmlComponent, JadeComponent, CssComponent, LessComponent, SassComponent]
})
export class FrontModule {
}
